package com.check;

/***
 * 验证对象配置枚举类
 * 用户自定义配置
 */
public enum ConfigurationEnum {

	/**保存用户信息验证：用户自定义配置**/
	USER_SAVE("/user/save", "com.model.UserService", "queryNameIfExist", "com.model.User"),

	/**未定义的枚举:不可更改**/
	UNDEFINED("undefined", "undefined", "undefined", "undefined");

	//请求路径
	private String url;
    //验证类Service
	private String fullPathClazz;
	//验证类Service方法
	private String methodName;
	//被验证的目标对象
	private String objectClazz;

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getFullPathClazz() {
		return fullPathClazz;
	}

	public void setFullPathClazz(String fullPathClazz) {
		this.fullPathClazz = fullPathClazz;
	}

	public String getMethodName() {
		return methodName;
	}

	public void setMethodName(String methodName) {
		this.methodName = methodName;
	}

	public String getObjectClazz() {
		return objectClazz;
	}

	public void setObjectClazz(String objectClazz) {
		this.objectClazz = objectClazz;
	}

	ConfigurationEnum(String url, String fullPathClazz, String methodName, String objectClazz){
		this.url = url;
		this.fullPathClazz = fullPathClazz;
		this.methodName = methodName;
		this.objectClazz = objectClazz;
	}

	public static ConfigurationEnum  getConfiguration(String url) {
		for (ConfigurationEnum ele : values()) {
			if(ele.getUrl().equals(url)){
				return ele;
			}
		}
		return UNDEFINED;
	}


}
